package com.hzit.portal.listener;

import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.domain.Content;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Component
@RabbitListener(queues = "hzit_content_remove")
@Slf4j
public class HzitRemoveContentListener {

	@Autowired
	private RedisService redisService;

	/**
	 * 将添加的一条记录添加到redis中
	 * @param ids
	 * @return
	 */
	@RabbitHandler
	public void getMessage(List<Long> ids){
		for (Long id : ids) {
			redisService.deleteCacheMapValue(CacheConstants.CONTENT_LIST,id + "");
		}
		log.info("同步从reids删除记录id:{}",ids);
	}

}
